package com.tuweiya.study.hibernate.hbm2ddl;

import javax.persistence.*;
import java.util.Date;

@Entity
@Table(name = "Student1")
public class Student1 {

    private int id ;

    /**
     * 默认都会加上 @Basic
     */
//    @Basic
    private String name ;

    private String address ;

    private String myWifeName ;

    private Date birthDate ;


    @Id
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    /**
     * @Temporal 用来刻画时间精度，默认为timestamp
     * 注解不写，默认为timestamp
     * @return
     */
    @Temporal(TemporalType.DATE)
    public Date getBirthDate() {
        return birthDate;
    }

    public void setBirthDate(Date birthDate) {
        this.birthDate = birthDate;
    }

    /**
     * 此字段不会存储到数据库里
     * @return
     */
    @Transient
    public String getMyWifeName() {
        return myWifeName;
    }

    public void setMyWifeName(String myWifeName) {
        this.myWifeName = myWifeName;
    }

    /**
     * @Column 用来解决属性名和字段名不对应
     * @return
     */
    @Column(name = "student_name")
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }
}
